package base.proxy;

import java.lang.reflect.Proxy;

/**
 * \* User: Administrator
 * <p>
 * \* Date: 2020/11/19
 * <p>
 * \* Time: 13:28
 * <p>
 * \* Description:
 * \
 */
public class DynamicProxyDemo {
    public static void main(String[] args) {
        Target target = new Target();
        HandlerImpl handler = new HandlerImpl(target);
        //获取代理对象
        TargetInterface o = (TargetInterface) Proxy.newProxyInstance(target.getClass().getClassLoader(), new Class[]{TargetInterface.class}, handler);
        o.test();
        o.test2();
    }
}
